<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="utf-8" />
        <title>Simple example - Editor.md examples</title>
        <link rel="stylesheet" th:href="@{/editior/css/style.css}" />
        <link rel="stylesheet" th:href="@{/editior/css/editormd.css}" />
        <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    </head>
    <body>
    <form class="form-inline" th:action="@{/admin/addBlog}" method="post">
        <div id="layout">
            <header>
                <div class="form-group">
                    <input type="hidden" name="id" th:value="${blogOneId}">
                    <label>标题</label>
                    <input type="text" class="form-control" style="width: 1000px" name="title" th:value="${blogOneTitle}">
                </div>
                <button type="submit" class="btn btn-default" value="0" name="blogStatus">保存</button>
                <button type="submit" class="btn btn-default" value="1" name="blogStatus">发布</button>
            </header>
            <div id="test-editormd">
                <textarea style="display:none;" th:name="edits" th:text="${blogOne}"></textarea>
            </div>
        </div>
    </form>
        <script th:src="@{/editior/js/jquery.min.js}"></script>
        <script th:src="@{/editior/js/editormd.min.js}"></script>
        <script th:inline="javascript">
			var testEditor;
            /*<![CDATA[*/
            var context = /*[[${#httpServletRequest.getContextPath()}]]*/ null;
            /*]]>*/
            $(function() {
                testEditor = editormd("test-editormd", {
                    width   : "90%",
                    height  : 640,
                    syncScrolling : "single",
                    path    : context+"/editior/lib/",
                    imageUpload    : true,
                    imageFormats   : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
                    imageUploadURL : context+"/file/upload",
                });
                
                /*
                // or
                testEditor = editormd({
                    id      : "test-editormd",
                    width   : "90%",
                    height  : 640,
                    path    : "../lib/"
                });
                */
            });
        </script>
    </body>
</html>